package cc.flybb.tianblog.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
 
/**
 * 模板测试.
 * @author Administrator
 *
 */
@RequestMapping("/hello")
@Controller
public class TemplateController {

	
    /**
     * 返回html模板.
     * http://localhost:8080/tianblog/hello/freemarker
     */
    @RequestMapping("/freemarker")
    public String freemarker(Map<String,Object> map){
        map.put("name", "[Angel -- 守护天使]");  
        map.put("gender",1);//gender:性别，1：男；0：女；  
         
        List<Map<String,Object>> friends =new ArrayList<Map<String,Object>>();  
        Map<String,Object> friend = new HashMap<String,Object>();  
        friend.put("name", "张三");  
        friend.put("age", 20);  
        friends.add(friend);  
        friend = new HashMap<String,Object>();  
        friend.put("name", "李四");  
        friend.put("age", 22);  
        friends.add(friend);  
        map.put("friends", friends); 
    	return"/freemarker/helloFtl";
    }
    
    
    /**
     * 返回html模板.
     */
    @RequestMapping("/thymeleaf")
    public String thymeleaf(Map<String,Object> map){
       map.put("hello","from TemplateController.helloHtml");
       return"/helloHtml";
    }
    
}